
import org.imooc.dto.AdDto;
import org.imooc.service.AdService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class test {

    @Test
    public void test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("spring/applicationContext.xml"); //获得容器
       AdService bookService = (AdService)context.getBean("AdServiceImpl"); // 从容器中获得需要的bean对象
       AdDto byId = bookService.getById((long) 1);
       System.out.println(byId);


    }
}
